package router

import (
	"github.com/gin-gonic/gin"
	"gorm.io/gorm"

	"admin-nexus-backend/internal/handler"
	"admin-nexus-backend/internal/service"
)

// SetupCityRoutes 设置城市管理路由
func SetupCityRoutes(router *gin.RouterGroup, db *gorm.DB) {
	// 创建服务实例
	cityService := service.NewCityService(db)
	cityHandler := handler.NewCityHandler(cityService)

	// 城市管理路由组
	cityRoutes := router.Group("/cities")
	{
		// 获取城市列表
		cityRoutes.GET("", cityHandler.GetCityList)
		// 根据ID获取城市信息
		cityRoutes.GET("/:id", cityHandler.GetCityByID)
		// 创建城市
		cityRoutes.POST("", cityHandler.CreateCity)
		// 更新城市
		cityRoutes.PUT("/:id", cityHandler.UpdateCity)
		// 删除城市
		cityRoutes.DELETE("/:id", cityHandler.DeleteCity)
		// 批量删除城市
		cityRoutes.POST("/batch-delete", cityHandler.BatchDeleteCity)
	}
}
